package com.hongxin.nw.netty.model.packing.info;

import com.hongxin.nw.netty.utils.FieldPack;
import com.hongxin.nw.netty.values.TypeIdentif;
import lombok.extern.slf4j.Slf4j;

/**
 * @remark A.35 充电设备数据上报参数设置
 * @author: GuoXiaolin
 * @date 2019/5/25 14:42
 * @Version 1.0
 * @Descibe
 */
@Slf4j
public class Csdna1_17 implements IPacking{

    private String co;
    private String chargeIndex;
    private String monitorInterval;//实时监测数据上报时间间隔	BIN码	2Byte	时间单位：分 (0表示不上传)
    private String changeInterval;//变化数据上传最小时间间隔	BIN码	2Byte	时间单位：秒 （0表示不上传）


    @Override
    public String packing(){
        return this.co +
                this.chargeIndex +
                this.monitorInterval +
                this.changeInterval;
    }

    public Csdna1_17 setCo(String co) {
        this.co = FieldPack.caseToBCD(co, TypeIdentif.BYTE_CO.getByteLength());
        return this;
    }

    public Csdna1_17 setChargeIndex(String chargeIndex) {
        this.chargeIndex = FieldPack.caseToBin(chargeIndex, TypeIdentif.BYTE_CHARGE_INTERFACE_IDENTIFY.getByteLength());
        return this;
    }

    public Csdna1_17 setMonitorInterval(String monitorInterval) {
        this.monitorInterval = FieldPack.caseToBin(monitorInterval, TypeIdentif.BYTE_MONITOR_INTERVAL.getByteLength());
        return this;
    }

    public Csdna1_17 setChangeInterval(String changeInterval) {
        this.changeInterval =  FieldPack.caseToBin(changeInterval, TypeIdentif.BYTE_CHANGE_INTERVAL.getByteLength());
        return this;
    }

    @Override
    public String toString() {
        return "Csdna1_17{" +
                "co='" + co + '\'' +
                ", chargeIndex='" + chargeIndex + '\'' +
                ", monitorInterval='" + monitorInterval + '\'' +
                ", changeInterval='" + changeInterval + '\'' +
                '}';
    }
}
